/* eslint-disable no-undef */
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import {
  Search, Col, Row, Notify,
} from 'vant'

const app = createApp(App)
app.use(router)
app.use(store)

app.use(Search)
app.use(Col)
app.use(Row)
app.use(Notify)

const render = (props = {}) => {
  const { container } = props
  app.mount(container ? container.querySelector('#app') : '#app')
}

if (window.__POWERED_BY_QIANKUN__) {
  __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__
} else {
  render()
}

export async function bootstrap() {
  console.log('vue app bootstraped')
}

export async function mount(props) {
  console.log('props from main framework', props)
  render(props)
}

export async function unmount() {
  console.log("VueMicroApp unmount")
}
